{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
ARG BASE={{ prefix }}p4lang/behavioral-model:latest
## ARG BASE=docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

FROM $BASE AS base

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

## Update apt source list to ubuntu Azure mirror
RUN sed -i 's|http://.*.ubuntu.com|http://azure.archive.ubuntu.com|g' /etc/apt/sources.list

RUN apt-get update

RUN apt-get install -f -y net-tools supervisor rsyslog  python3-pip
RUN pip3 install supervisord-dependent-startup

COPY ["start.sh", "/usr/bin/"]

## COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
## COPY ["critical_processes", "/etc/supervisor/"]

FROM scratch

# RUN --mount=type=bind,from=base,target=/changes-to-image rsync -axAX --no-D --exclude=/sys --exclude=/proc --exclude=/dev --exclude=resolv.conf /changes-to-image/ /
COPY --from=base / /

## ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT ["/usr/bin/start.sh"]
